package com.coship.vasms.adstorm.service.impl;

import java.util.List;

import com.coship.vasms.adstorm.common.DateHelper;
import com.coship.vasms.adstorm.dao.ADArrangeDao;
import com.coship.vasms.adstorm.model.ADArrange;
import com.coship.vasms.adstorm.service.ADArrangeService;

public class ADArrangeServiceImpl implements ADArrangeService {

	private ADArrangeDao adarrangeDao = null;

	public ADArrangeDao getAdarrangeDao() {
		return adarrangeDao;
	}

	public void setAdarrangeDao(ADArrangeDao adarrangeDao) {
		this.adarrangeDao = adarrangeDao;
	}

	@Override
	public void delete(Integer id) {
		adarrangeDao.delete(id);
	}

	@Override
	public ADArrange findById(Integer id) {
		return adarrangeDao.findById(id);
	}

	@Override
	public List<ADArrange> queryAll() {
		return adarrangeDao.queryAll();
	}

	@Override
	public List<ADArrange> queryByAdvertiseId(Integer advertiseId) {
		return adarrangeDao.queryByAdvertiseId(advertiseId);
	}

	@Override
	public List<ADArrange> queryByPositionBasicCode(String positionBasicCode) {
		return adarrangeDao.queryByPositionBasicCode(positionBasicCode);
	}

	@Override
	public List<ADArrange> queryByPositionInfoCode(String positionInfoCode) {
		return adarrangeDao.queryByPositionInfoCode(positionInfoCode);
	}

	@Override
	public List<ADArrange> queryByTime(String time) {
		return adarrangeDao.queryByTime(time);
	}

	@Override
	public void save(ADArrange adarrange) {
		adarrangeDao.save(adarrange);
	}

	@Override
	public void update(ADArrange adarrange) {
		adarrangeDao.update(adarrange);
	}

	@Override
	public int updateArrangeByBasicCode(String positionBasicCode, int state) {
		// TODO Auto-generated method stub
		ADArrange adarrange = new ADArrange();
		//设置更新时间
		adarrange.setLastUpdateTime(DateHelper.getCurrentSecond());
		adarrange.setPositionBasicCode(positionBasicCode);
		adarrange.setState(state);
		return adarrangeDao.updateArrangeByBasicCode(adarrange);
	}

	@Override
	public int updateArrangeByPositionCode(String positionCode, int state) {
		// TODO Auto-generated method stub
		ADArrange adarrange = new ADArrange();
		adarrange.setPositionBasicCode(positionCode);
		adarrange.setState(state);
		return adarrangeDao.updateArrangeByBasicCode(adarrange);
	}

	@Override
	public ADArrange queryByPositionBasicCodeAndTime(String positionBasicCode,
			String time) {
		return adarrangeDao.queryByPositionBasicCodeAndTime(positionBasicCode, time);
	}

}
